<template>
	<view class="m-cart">
		<view class="top">{{restaurantName}}</view>
		<view class="wrap">
			<u-swiper :list="swiperList" :effect3d="true"></u-swiper>
		</view>
		<u-grid :col="2">
			<u-grid-item @click="goShopping1()">
				<u-icon name="car" :size="80"></u-icon>
				<view class="grid-text">外卖</view>
			</u-grid-item>
			<u-grid-item @click="goShopping2()">
				<u-icon name="map" :size="80"></u-icon>
				<view class="grid-text">堂食</view>
			</u-grid-item>
		</u-grid>
		<swiper-item class="swiper-item">
			<scroll-view scroll-y style="height:100%;width: 100%;">
				<!-- @scrolltolower= @click="toAddressDetail(item)"-->
			<!-- <u-card :head-border-bottom="false" :foot-border-top="false">通知公告</u-card> -->
			<view class="notice-top">通知公告</view>
				<view class="page-box" v-if="noticeList.length!=0">
					<view v-for="(item,index) in noticeList" :key="index">
						<u-card :head-border-bottom="false" :foot-border-top="false" padding="5">
							<view class="notice-title" slot="body">
								<view class="head-container">
									<view>通知公告  {{index+1}}</view>
									<view class="name">通知时间:  {{item.updateTime || item.createTime}}</view>
									<view class="head-title">最后编辑人： {{item.updateBy || item.createBy}}</view>
									<view class="two">
										<text class="head-title">公告类型:  
											<text v-if="item.noticeType == '1'"> 通知</text>
											<text v-else-if="item.noticeType == '2'"> 公告</text>
										</text>
									</view>
									<text class="label">标题:  {{item.noticeTitle}}</text>
								</view>
							</view>
							<!-- <view class="" slot="foot">
								<view style="display: flex; flex-wrap: wrap;">
									<view class="item-container">
										<text class="label">标题: {{item.noticeTitle}}</text>
										<text class="label">内容: {{item.noticeContent}}</text>

									</view>

								</view>

							</view> -->
						</u-card>
					</view>
				</view>
			</scroll-view>
		</swiper-item>
	</view>
</template>

<script>
	import config from '@/config'
	import {
		getNotices
	} from '@/api/system/notice/notice'
	export default {
		data() {
			return {
				noticeList: [],
				restaurantName: "",
				cartShopData: [],
				tablelist: [],
				swiperList: [{
						image: '/static/images/chaomian.jpg'
					},
					{
						image: '/static/images/dongbeicai.jpg'
					},
					{
						image: '/static/images/miantiao.jpg'
					},
					{
						image: '/static/images/jiaozi.jpg'
					}
				]
			}
		},
		onLoad() {
			this.restaurantName = config.restaurantName
			this.getNoticeList()
		},
		mounted() {},
		methods: {
			getNoticeList() {
				getNotices().then(res => {
					this.noticeList = res.rows
					console.log(this.noticeList)
				})
			},
			goShopping1() {
				this.$store.dispatch('updateDineStyle', "外卖")
				this.$tab.switchTab("/pages/shop/shop");
			},
			goShopping2() {
				this.$store.dispatch('updateDineStyle', "堂食")
				this.$tab.switchTab("/pages/shop/shop");
			}

		}
	}
</script>

<style scoped lang="scss">
	.notice-title{
		padding: 2px 5px 5px ;
	}
	
	.notice-top{
		text-align: center;
		margin: 5px 18px 0 18px;
		border-radius: 10px;
		padding-top: 5px;
		padding-bottom: 5px;
		background-color: white;
		font-size: large;
	}
	
	.top {
		height: 55px;
		padding-top: 48px;
		text-align: center;
		font-size: 20px;
	}

	.wrap {
		padding: 70rpx;
	}

	.grid-text {
		font-size: 30rpx;
		font-weight: 65px;
		margin-top: 4rpx;
		color: $u-type-info;
	}
</style>